<template>
  <div>
    <div class="title">热门推荐</div>
    <ul>
      <router-link
        class="item"
        v-for="item in list"
        :key="item.id"
        tag="li"
        :to="'/detail/' + item.id"
      >
        <img :src="item.imgUrl" :alt="item.id" class="item__img" />
        <div class="item__info">
          <p class="item__info__title">{{ item.title }}</p>
          <p class="item__info__desc">{{ item.desc }}</p>
          <button class="item__info__btn">查看详情</button>
        </div>
      </router-link>
    </ul>
  </div>
</template>

<script>
export default {
  name: "HomeRecommend",
  props: {
    list: Array,
  },
};
</script>

<style lang="scss" scoped>
@import "~../../../../assets/style/minixs.scss";
.title {
  margin-top: 0.2rem;
  height: 0.7rem;
  line-height: 0.7rem;
  font-size: 0.3rem;
  font-weight: bold;
  background: #eee;
  // 文本缩进
  text-indent: 0.2rem;
}
.item {
  display: flex;
  height: 1.9rem;
  overflow: hidden;
  border-bottom: 0.01rem solid #ccc;
  &__img {
    width: 1.7rem;
    height: 1.7rem;
    padding: 0.1rem;
  }
  &__info {
    flex: 1;
    padding: 0.1rem;
    min-width: 0;
    &__title {
      line-height: 0.54rem;
      font-size: 0.3rem;
      font-weight: bold;
      @include ellipsis();
    }
    &__desc {
      line-height: 0.44rem;
      color: #ccc;
      @include ellipsis();
    }
    &__btn {
      line-height: 0.4rem;
      margin-top: 0.16rem;
      padding: 0 0.2rem;
      color: #fff;
      background-color: skyblue;
      border-radius: 0.06rem;
    }
  }
}
</style>